<script>
  $(document).ready(function() {
    $("#submission_common_name" ).autocomplete({
        source: birdArray
    });
	
	$(".subHead").on("click",function(event) {
		var titleName = $(this).attr("id");
		var divName = titleName.replace("Title","");
		
		if($("#" + divName).is(":visible")) {
			$("#" + divName).slideUp();
			$(this).text(function () {
				return $(this).text().replace("-", "+"); 
			});
		}
		else {
			$("#" + divName).slideDown();
			$(this).text(function () {
				return $(this).text().replace("+", "-"); 
			});
		}
	});
	
	$("[id$=Admin]").hide();
	
});
   var birdArray = <%= Bird.all.map(&:common_name).sort.to_json.html_safe %>;
   
   
   
   

</script>

<h1 id="userAdminTitle" class="subHead">User Administration +</h1>
  <div id="userAdmin">

<%= render :partial => 'users/searchform' %>
</div>


<h1 id="submissionAdminTitle" class="subHead">Submission Administration +</h1>
  <div id="submissionAdmin">

<%= render :partial => 'submissions/searchform' %>

<%= link_to "Pending Submissions (#{@numpending})", pending_submissions_path %> | 
<%= link_to "Submissions Awaiting Approval (#{@numnew})", new_submissions_submissions_path %>
</div>



<h1 id="postAdminTitle" class="subHead">Post Administration +</h1>
  <div id="postAdmin">

<%= render :partial => 'posts/list' %>
</div>

<h1 id="birdAdminTitle" class="subHead">Bird Administration +</h1>
  <div id="birdAdmin">

<%= render :file => 'birds/index' %>

</div>